package com.bbex.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Configuration
@ConfigurationProperties(prefix = "coin.addr")
public class CoinAddressConfig {

    private List<Map<String, String>> list = new ArrayList<>();

    public String getAddress(String coinSymbol) {
        for (Map<String, String> map : list) {
            String symbol = map.get("symbol");
            if (coinSymbol.equals(symbol)) {
                String address = map.get("address");
                return address;
            }
        }
        return null;
    }

    public List<Map<String, String>> getList() {
        return list;
    }

    public void setList(List<Map<String, String>> list) {
        this.list = list;
    }
}
